/*
day59
2019.10.26
*/
#define MAX(A,B) (  (A) > (B) ? (A) : (B)  )
struct TreeNode {
	int val;
	struct TreeNode *left;
	struct TreeNode *right;
};

int depth (struct TreeNode *root,int a[])
{
	if(!root) return 0;
	int l = depth(root->left,a);
	int r = depth(root->right,a);
	int cur = l + r;
	if( cur > a[0] ) a[0] = cur;
	return MAX(l,r)+1;
}

int diameterOfBinaryTree(struct TreeNode* root){
	int a[]={0};
	depth(root,a);
	return a[0];
}
int main()
{
	return 0;
}
